package View
{
	import laya.events.Event;
	import laya.utils.Mouse;
	
	import ui.HanmerUI;
	
	/**
	 * 类描述
	 * @author sixsir
	 * @date 2016-11-26上午12:12:38
	 */
	public class Hammer extends HanmerUI
	{
		public function Hammer()
		{
			super();
		}
		
		public function start():void
		{
			Mouse.hide();
			Laya.stage.on(Event.MOUSE_MOVE, this, onMouseMove);
			Laya.stage.on(Event.CLICK, this, onMouseClick);
			onMouseMove();
		}
		
		private function onMouseClick():void
		{
			this.hammer.play(0, false);	
		}
		
		private function onMouseMove():void
		{
			this.x = Laya.stage.mouseX - 20;
			this.y = Laya.stage.mouseY - 40;
		}
		
		public function end():void
		{
			Mouse.show();
			Laya.stage.off(Event.MOUSE_MOVE, this, onMouseMove);
			Laya.stage.off(Event.CLICK, this, onMouseClick);
		}
	}
}